package com.sangmo.fts.basic.model;

import com.sangmo.boot.framework.data.entity.general.LongEntity2;
import com.sangmo.boot.framework.data.json.meta.ExtView;
import com.sangmo.boot.framework.data.json.meta.One;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataField;
import com.sangmo.fts.user.model.User;

import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "audit_log")
@ExtView
//@Formula(value = "text", calc = AuditLog.ILogMessage.class, groups = {"audit.search", "audit.detail"})
public class AuditLog extends LongEntity2 {
    @One(src = "createdBy", value = "creator", target = User.class, fieldset = {"id", "name"})

    @DataField(index = true)
    private String category;
    @DataField(index = true)
    private String type;
    private String content;
    @DataField(index = true)
    private String state = States.NORMAL;
    @DataField(index = true)
    private String refNo;
    @DataField(index = true)
    private String refType;
    private String subNo;
    @DataField(index = true)
    private String traceId;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getRefNo() {
        return refNo;
    }

    public void setRefNo(String refNo) {
        this.refNo = refNo;
    }

    public String getRefType() {
        return refType;
    }

    public void setRefType(String refType) {
        this.refType = refType;
    }

    public String getSubNo() {
        return subNo;
    }

    public void setSubNo(String subNo) {
        this.subNo = subNo;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public interface States {
        String NORMAL = "NORMAL";
        String CLEAR = "CLEAR";
        String ALERT = "ALERT";
    }

    public interface Categories {
        String ENTITY = "ENTITY";
        String CHANGE = "CHANGE";
    }

    public interface ILogMessage {

    }
}